package com.hn658.user.core.dao.db.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.Validate;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import com.hn658.framework.dataaccess.mybatis.AbstractMyBatisDAO;
import com.hn658.framework.dataaccess.mybatis.MyBatisPostfixConstants;
import com.hn658.framework.dataaccess.pagination.GenericPage;
import com.hn658.framework.shared.exception.BusinessException;
import com.hn658.user.common.entity.EmployeeEO;
import com.hn658.user.common.vo.EmpAndDeptDTO;
import com.hn658.user.core.dao.db.IEmployeeDBDAO;
@Repository
public class EmployeeDBDAO  extends AbstractMyBatisDAO<EmployeeEO, Long>
implements IEmployeeDBDAO {

	@Override
	public void deleteEmployee(String id) {
		if(id==null){
			throw new BusinessException("id不能为空");
		}
		this.getSqlSession().delete(this.mapperNamespace+".deleteByPrimaryKey",id);
	}

	@Override
	public void updateEmployee(EmployeeEO employeeEO) {
		if(employeeEO==null){
			throw new BusinessException("不能为空");
		}
		this.getSqlSession().update(this.mapperNamespace+".updateByPrimaryKeySelective",employeeEO);
	}

	@Override
	public void addEmployee(EmployeeEO employeeEO) {
		if(employeeEO==null){
			throw new BusinessException("不能为空");
		}
		this.getSqlSession().insert(this.mapperNamespace+".insertSelective",employeeEO);
	}

	@Override
	public EmployeeEO selectByIdToEmp(String id) {
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("uid", id);
		EmployeeEO selectOne = this.getSqlSession().selectOne(this.mapperNamespace+".selectById", map);
		return selectOne;
	}
	
}
